Skip to content
This repository has been archived by the owner on Sep 1, 2020. It is now read-only.

Latest commit

 

History

History
25 lines (20 loc) · 543 Bytes

10.22 - Process::exportSocket.md

File metadata and controls

25 lines (20 loc) · 543 Bytes

Process::exportSocket

将管道导出为Coroutine\Socket对象。

function Process::exportSocket() : Swoole\Coroutine\Socket;
  • 多次调用此方法,返回的对象是同一个

返回值

  • 成功返回Coroutine\Socket对象
  • 进程未创建管道,操作失败,返回false

使用实例

$proc1 = new Swoole\Process(function (Swoole\Process $proc) {
    $socket = $proc->exportSocket();
    echo $socket->recv();
    $socket->send("hello proc2\n");
    echo "proc1 stop\n";
}, false, 1, true);